package com.base.web.core.util;
import java.time.LocalDateTime;
import java.time.ZoneOffset;

/**
 * Created with IntelliJ IDEA.
 * Description: 时间工具类
 *
 * @Author: rentie
 * @Date: 2018/7/16 10:12
 */

public class TimeUtil {

	/**
	 * 获取当前时间戳，精确到秒
	 * @return
	 */
	public static Long getCurrentTimeSecond(){
		return  LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8"));
	}

	/**
	 * 获取当前时间戳，精确到毫秒
	 * @return
	 */
	public static Long getCurrentTimeMillisecond(){
		return LocalDateTime.now().toInstant(ZoneOffset.of("+8")).toEpochMilli();
	}

}
